home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / PURGEUSR.422 < prev    next >
Text File  |  1993-02-23  |  4KB  |  81 lines

  1. Nightly User Purge Mod . . .
  2. Dr. Dre #1 @1 7-=1Top Administrator7=-0
  3. Mon Feb 22 07:03:56 1993
  4. ┌───────────────────────────────────────────────────────────────────────────┐
  5. │ Mod Name  : Nightly user purge   Mod Author: BitByteBob 1@6755 WWIVnet    │
  6. │                                                                           │
  7. │ Difficulty: Block copy           Date      : 28JAN93                      │
  8. │                                                                           │
  9. │ Version   : WWIV 4.22            File Name : BBBOB07.MOD                  │
  10. │                                                                           │
  11. │ Description: As part of the nightly routine, deletes users that have      │
  12. │              been inactive for a set period of time.  Also has an         │
  13. │              exemption flag for users that you want to keep.              │
  14. │              Sends SysOp an SSM for each deleted user, and puts           │
  15. │              the info into the log.                                       │
  16. │                                                                           │
  17. └───────────────────────────────────────────────────────────────────────────┘
  18.  
  19. #include <std\disclaim.doc>
  20.  
  21. This is NOT my mod, but I dont remember where the original code came from,
  22. but I like it, so I'm releasing it again.
  23.  
  24. To keep users from being deleted, change their exemption to include 16.
  25.  
  26. Change the limit=60; line to whatever day limit you want to allow
  27. inactivity for.
  28.  
  29. . = existing line
  30. + = add this line
  31. - = delete this line
  32. | = modify this line
  33.  
  34.  
  35. Open up SYSOPF.C, and add this function to the bottom:
  36.  
  37.  
  38. +void auto_user_purge(void)
  39. +{                                                           /* BBBOB07.MOD */
  40. +  userrec u;                                                /* BBBOB07.MOD */
  41. +  int un,nu,limit;                                          /* BBBOB07.MOD */
  42. +  long l;                                                   /* BBBOB07.MOD */
  43. +  unsigned int d;                                           /* BBBOB07.MOD */
  44. +  char s[80];                                               /* BBBOB07.MOD */
  45. +                                                            /* BBBOB07.MOD */
  46. +  limit=60;    /* Number of days of inactivity before delete.  BBBOB07.MOD */
  47. +  time(&l);                                                 /* BBBOB07.MOD */
  48. +  un=1;                                                     /* BBBOB07.MOD */
  49. +  read_user(un,&u);                                         /* BBBOB07.MOD */
  50. +  nu=(int)  (filelength(userfile) / sizeof(userrec)) - 1;   /* BBBOB07.MOD */
  51. +  sprintf(s,"Auto-Purging Non-Active Users (over %d days)\r\n",limit);
  52. +  sl1(0,s);                                                 /* BBBOB07.MOD */
  53. +                                                            /* BBBOB07.MOD */
  54. +  do {                                                      /* BBBOB07.MOD */
  55. +    read_user(un,&u);                                       /* BBBOB07.MOD */
  56. +    if (!(u.exempt & 0x10)) {                               /* BBBOB07.MOD */
  57. +      d=(unsigned int) ((l-u.daten)/24.0/3600.0);           /* BBBOB07.MOD */
  58. +      if (((u.inact & inact_deleted)==0) && (d>limit)) {    /* BBBOB07.MOD */
  59. +        sprintf(s," ·Deleted Inactive User: #%3d %s",un,u.name);
  60. +        ssm(1,0,s);                                         /* BBBOB07.MOD */
  61. +        sl1(0,s);                                           /* BBBOB07.MOD */
  62. +        deluser(un);                                        /* BBBOB07.MOD */
  63. +      }                                                     /* BBBOB07.MOD */
  64. +    }                                                       /* BBBOB07.MOD */
  65. +    ++un;                                                   /* BBBOB07.MOD */
  66. +  }                                                         /* BBBOB07.MOD */
  67. +  while (un<=nu);                                           /* BBBOB07.MOD */
  68. +}                                                           /* BBBOB07.MOD */
  69.  
  70. Then, go back up to the bottom of beginday(void), and add:
  71.  
  72. .  if ((!syscfg.closedsystem) && (nus<15)){
  73. .    sprintf(s,get_stringx(1,19),nus);
  74. .    ssm(1,0,s);
  75. .  }
  76. +  auto_user_purge();                                        /* BBBOB07.MOD */
  77. }
  78.  
  79.  
  80. Compile!   
  81.